You are here: irt.org | FOLDOC | Yoda condition
<programming> The programming practise of using
if (constant == variable)e.g.
if (4 == foo)instead of the more natural
if (variable == constant)It is named after the Star Wars character Yoda who says things like "Strong is Vader". It may have been invented as a way to prevent coding errors like
if (count = 5)(accidentally using a single "=" (assignment) instead of a double "==" (comparison)). The above is syntactically valid whereas the Yoda equivalent would give a compile-time error.
(2012-06-25)
Nearby terms: YMODEM « YMODEM-G « yocto- « Yoda condition » YOL Computers » yotta- » yottabyte
FOLDOC, Topics, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, ?, ALL